Communication device, control method therefor, and program

ABSTRACT

Even when a plurality of communication parameter providing devices exist, a communication parameter setting process is enabled. When a plurality of communication parameter providing devices exist, one of the communication parameter providing devices is determined. For example, all the communication parameter providing devices are caused to stop the providing process. Alternatively, a user is allowed to select a communication parameter providing device. Alternatively, a communication parameter providing device is determined in accordance with a predetermined rule.

CROSS-REFERENCE TO RELATED APPLICATION

This application is a Continuation of co-pending U.S. patent applicationSer. No. 14/151,981, filed Jan. 10, 2014; which is a Continuation ofco-pending U.S. patent application Ser. No. 13/254,899 filed Sep. 6,2011, which is a National Phase application of International ApplicationPCT/JP2010/001503, filed Mar. 4, 2010, which claims the benefit ofJapanese Patent Application No. 2009-058268, filed Mar. 11, 2009, whichis hereby incorporated by reference herein in its entirety.

TECHNICAL FIELD

The present invention relates to a communication device, a controlmethod therefor, and a program.

BACKGROUND ART

In wireless communication such as wireless local area networks (LANs)based on the Institute of Electrical and Electronics Engineers (IEEE)802.11 series of standards, there are a large number of setting items tobe set before use.

Examples of the setting items include communication parameters necessaryfor wireless communication, such as a service set identifier (SSID)serving as a network identifier (ID), an encryption method, anencryption key, an authentication method, and an authentication key. Itis troublesome for users to set all of them by manual input. Manymanufacturers have developed automatic setting methods for easilysetting communication parameters in wireless devices. The automaticsetting methods allow automatic setting of communication parameters byproviding the communication parameters from one device to another deviceusing a predetermined procedure and using messages.

NPL 1 discloses a Wi-Fi Protected Setup (WPS), which is an industrystandard specification for automatic setting of communication parametersbetween an access point (base station) and a station (terminal station).There are methods as follows to configure WPS: a push button method anda personal identification number (PIN) method. In the push buttonmethod, a button is pressed on both devices. In the PIN method, apredetermined PIN code is set in both the Registrar and the Enrollee andcommunication parameters are set between devices having matching PINcodes.

CITATION LIST Patent Literature

-   [NPL 1] Wi-Fi CERTIFIED™ for Wi-Fi Protected Setup: Easing the User    Experience for Home and Small Office Wi-Fi (R) Networks, which is    available from http://www.wi-fi.org/wp/wifi-protected-setup

SUMMARY OF INVENTION Technical Problem

In WPS, the roles of a device that provides a communication parameter(hereinafter referred to as a “providing device”) and a device thatreceives the communication parameter (hereinafter referred to as a“receiving device”) are determined in advance. Therefore, the transferdirection of the communication parameter is uniquely determined.

When a plurality of providing devices exist, it is difficult for areceiving device to determine a providing device from which acommunication parameter is received. In this case, in the WPS pushbutton method, upon detection of a plurality of providing devices, areceiving device terminates a WPS process. In the WPS PIN method, thereceiving device handshakes with the providing devices in the orderdetected, and performs a WPS process with a providing device having aPIN that matches that of the receiving device. In a situation where aplurality of providing devices exist, therefore, it is not possible toperform an automatic communication parameter setting process using thepush button method. Even the PIN method can require much time. Note thatWPS does not specify the automatic setting of communication parametersin an ad-hoc mode.

When a plurality of providing devices are operating in differentwireless LAN channels, the wireless LAN channels are limited in terms ofaccessibility by a receiving device to reduce the number of candidateproviding devices. In a case where the providing devices are operatingin the same channel, however, it is difficult to narrow down thecandidates. In this case, even when one wireless LAN channel isdetermined, it is difficult to determine a providing device thatprovides a communication parameter and to automatically set acommunication parameter.

Accordingly, the present invention enables the setting of acommunication parameter even with the presence of a plurality ofproviding devices that are available to provide a communicationparameter.

Solution to Problem

In an aspect of the present invention, a communication parameterproviding device is searched for. When a plurality of communicationparameter providing devices adapted to provide a communication parameterare detected, the plurality of communication parameter providing devicesare caused to stop operating as communication parameter providingdevices. Alternatively, a user is prompted to select one of thecommunication parameter providing devices, or the communicationparameter providing devices themselves determine one of them inaccordance with a predetermined rule.

Advantageous Effects of Invention

According to an aspect of the present invention, when a plurality ofproviding devices exist, the possibility of failure occurring in anautomatic communication parameter setting process can be reduced.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram of a device.

FIG. 2 is a block diagram of software functions in the device.

FIG. 3 is a network configuration diagram.

FIG. 4 is a network configuration diagram.

FIG. 5 is an operation sequence diagram of devices A, B, and C.

FIG. 6 is an operation sequence diagram of devices A, B, and C.

FIG. 7 is an operation sequence diagram of devices A, B, and C.

FIG. 8 is an operation sequence diagram of devices A, B, and C.

FIG. 9 is a flowchart of the operation of a communication device.

DESCRIPTION OF EMBODIMENTS First Embodiment

A communication device according to a first embodiment will be describedin detail with reference to the drawings. In the following description,a wireless LAN system based on the IEEE 802.11 series of standards isused by way of example. However, a communication medium other than IEEE802.11-based wireless LANs may be used.

A hardware configuration in an example in the embodiment will now bedescribed.

FIG. 1 is a block diagram illustrating an example configuration of eachof devices described below. A device 101 includes a control unit 102, astorage unit 103, a wireless unit 104, a display unit 105, and a settingbutton 106. The control unit 102 controls the overall operation of thedevice 101 by executing a control program stored in the storage unit103. The control unit 102 further controls the setting of acommunication parameter with another device. The storage unit 103 storesthe control program executed by the control unit 102, and various typesof information such as communication parameters. The control programstored in the storage unit 103 is executed by the control unit 102 toperform operations described below.

The wireless unit 104 is configured to perform wireless LANcommunication based on the IEEE 802.11 series of standards. The displayunit 105 is configured to perform various kinds of display, and has afunction for outputting visually recognizable information, such as thefunctionality of a liquid crystal display (LCD) or a light emittingdiode (LED), or a function for outputting sound, such as thefunctionality of a speaker.

The setting button 106 triggers the start of an automatic communicationparameter setting process. When the setting button 106 is operated, anautomatic communication parameter setting process is started. Upondetection of an operation of the setting button 106 by a user, thecontrol unit 102 performs a process described below.

The device 101 further includes an antenna control unit 107, an antenna108, an input unit 109, and a functional unit 110. The input unit 109allows a user to perform various types of input. When the device 101 isimplemented as a digital camera, the functional unit 110 may serve as animage capturing unit. When the device 101 is implemented as a printer,the functional unit 110 may serve as a printing unit. When the device101 is implemented as a mobile phone, the functional unit 110 may serveas a calling unit and a public wireless unit. The functional unit 110may serve as any functional unit depending on the type of the device101. The setting button 106 may be dedicated or shared with otherfunction. For example, when the device 101 is implemented as a camera,the setting button 106 may be shared with a shutter button, a SET buttonused for various settings, and other buttons. When the device 101 isimplemented as a printer, the setting button 106 may be shared with areset button, a SET button used for various settings, and other buttons.

FIG. 2 is a block diagram illustrating an example configuration ofsoftware function blocks configured to execute an automaticcommunication parameter setting operation described below. Elementscorresponding to the functional unit 110 illustrated in FIG. 1 are notillustrated.

A device 201 includes an automatic communication parameter settingfunction block 202. In the embodiment, the automatic communicationparameter setting function block 202 is configured to automatically setcommunication parameters necessary for wireless LAN communication, suchas an SSID serving as a network ID, an encryption method, an encryptionkey, an authentication method, and an authentication key. Automaticcommunication parameter setting is hereinafter referred to simply as“automatic setting”.

A packet receiving unit 203 is configured to receive packets involved invarious kinds of communication. A beacon (notification signal) isreceived by the packet receiving unit 203. A packet transmitting unit204 is configured to transmit packets involved in various kinds ofcommunication. A beacon is transmitted by the packet transmitting unit204. Every beacon contains various kinds of information about thetransmission source device.

A search signal transmitting unit 205 is configured to control thetransmission of a device search signal such as a probe request. Theprobe request may also serve as a network search signal for searchingfor a desired network. A probe request is transmitted by the searchsignal transmitting unit 205. A probe response serving as a responsesignal to a received probe request is also transmitted by the searchsignal transmitting unit 205. In the embodiment, when a user operatesthe setting button 106 and starts an automatic setting process, aninformation element (IE) indicating that automatic setting is inprogress (an automatic setting operation is currently being performed)is added to a beacon, a probe request, and a probe response before theyare transmitted.

A search signal receiving unit 206 is configured to control thereception of a device search signal such as a probe request from anotherdevice. A probe request is received by the search signal receiving unit206. A probe response is also received by the search signal receivingunit 206. Every device search signal and every response signal theretocontain various kinds of information about the transmission sourcedevice.

A network control unit 207 is configured to control network connections.A process for setting up a connection to a wireless LAN ad-hoc networkor the like is performed by the network control unit 207.

The automatic setting function block 202 includes a communicationparameter receiving unit 208, a communication parameter providing unit209, and an automatic setting control unit 210. The communicationparameter receiving unit 208 is configured to receive (accept) acommunication parameter from a communication counterpart. Thecommunication parameter providing unit 209 is configured to provide acommunication parameter to a communication counterpart. The automaticsetting control unit 210 is configured to control various protocols usedfor automatic setting. An automatic setting process described below isperformed by the communication parameter receiving unit 208 and thecommunication parameter providing unit 209 under the control of theautomatic setting control unit 210.

The automatic setting control unit 210 further determines whether or notthe elapsed time since the start of the automatic setting processexceeds a time limit. When it is determined that the elapsed timeexceeds the time limit, the automatic setting process is terminatedunder the control of the automatic setting control unit 210.

The automatic setting function block 202 further includes a providerdetection unit 211 and a communication parameter storage unit 212. Theprovider detection unit 211 is configured to detect a device thatprovides a communication parameter (hereinafter referred to as a“providing device”). The provider detection unit 211 detects a providingdevice in accordance with a search signal transmitted and a responsethereto, which are handled by the search signal transmitting unit 205and the search signal receiving unit 206. The provider detection unit211 can also detect a providing device in accordance with a beaconreceived by the packet receiving unit 203. In order to receive acommunication parameter, a request for providing a communicationparameter is sent to a detected providing device, and the communicationparameter is provided therefrom. In the following description, a devicethat receives a communication parameter is referred to as a “receivingdevice”.

The communication parameter storage unit 212 stores a communicationparameter received from a providing device or a communication parameterprovided to a receiving device. The communication parameter storage unit212 corresponds to the storage unit 103. In the embodiment, when acommunication parameter is received from another device, thecommunication parameter is stored in the storage unit 103 as a setparameter. In addition, when a communication parameter is provided toanother device, the communication parameter is stored in the storageunit 103 as a set parameter. A set parameter stored in the storage unit103 may be discarded when communication via a network established usingthe set parameter is completed. A set parameter may also be discarded ata predetermined time such as after the lapse of a certain period of timesince the parameter is stored in the storage unit 103 or when the devicepower is turned off.

A beacon control unit 213 is configured to control the transmissiontiming of a beacon (notification signal). A beacon generation unit 214generates a beacon. The generated beacon is transmitted from the packettransmitting unit 204 to a network.

All the functional blocks have correlation in software or hardware. Thefunctional blocks described above are examples. A plurality offunctional blocks may constitute a single functional block, or one ofthe functional blocks may be divided into blocks each achieving aplurality of functions.

FIG. 3 is a diagram illustrating a communication device A 32(hereinafter referred to as a “device A”), a communication device B 33(hereinafter referred to as a “device B”), a communication device C 35(hereinafter referred to as a “device C”), a communication device D 36(hereinafter referred to as a “device D”), a communication device E 37(hereinafter referred to as a “device E”), an ad-hoc network A 31(hereinafter referred to as a “network A”), and an ad-hoc network B 34(hereinafter referred to as a “network B”). Each of the abovecommunication devices has the configuration described above withreference to FIG. 1 and FIG. 2.

It is assumed that the network A has already been established betweenthe devices A and D using a communication parameter A shared between thedevices A and D by performing an automatic setting process therebetween.In the automatic setting process performed between the devices A and D,it is assumed that the device A operates as a providing device and thedevice D operates as a receiving device.

It is also assumed that the network B has already been establishedbetween the devices B and E using a communication parameter B sharedbetween by the devices B and E by performing an automatic settingprocess therebetween. In the automatic setting process performed betweenthe devices B and E, it is assumed that the device B operates as aproviding device and the device E operates as a receiving device.

Here, the networks A and B are different networks. The differentnetworks may be networks whose basic service set identifiers (BSSIDs)serving as network IDs are different regardless of whether the wirelessLAN channels are the same or different, or may be networks that have thesame BSSID but use different wireless LAN channels. The term “wirelessLAN channel” means a frequency channel.

In the embodiment, a description will be given of a case where thedevice B participating in the network B has accidentally started anautomatic setting operation when automatic setting is to be performedbetween the device C and the device A participating in the network A inorder to cause the device C to participate in the network A.

FIG. 5 is a diagram illustrating an example of a process sequence forperforming an automatic setting process between the devices A, B, and Cby pressing the setting buttons 106 thereof.

The device A has already established the network A with the device Dusing the communication parameter A set in the automatic setting processperformed between the devices A and D (F501). The device B has alreadyestablished the network B with the device E using the communicationparameter B set in the automatic setting process performed between thedevices B and E (F509).

When the setting buttons 106 of the respective devices are pressed, thedevice A confirms that it is participating in a network (F502). Sincethe device A is participating in a network, the device A assigns itsrole to “providing device” (F503). Thereafter, the device A searches fora providing device operating in the same wireless LAN channel (as thewireless LAN channel of the network A) (F504). In order to search for aproviding device, the device A transmits a search signal (probe request)to the same wireless LAN channel (F505).

The device B performs an operation similar to that of the device A.Specifically, the device B confirms that it is participating in anetwork (F510). Since the device B is participating in a network, thedevice B assigns its role to “providing device” (F511). Then, the deviceB searches for a providing device operating in the same wireless LANchannel (as the wireless LAN channel of the network B) (F512). In orderto search for a providing device, the device B transmits a search signalto the same wireless LAN channel (F513).

In contrast, since the device C is not participating in a network, thedevice C performs a network search process on a plurality of wirelessLAN channels (F506). The wireless LAN channels to be searched may be allsupported wireless LAN channels or may be a plurality of channelsspecified in advance by a user. The device C transmits a search signalto each of the channels (F507, F514). The search signal has an automaticsetting function or includes an information element indicating anautomatic setting process in progress.

When the device C searches through the channel on which the network A isoperating, the device A transmits a search response signal to the deviceC (F508). Further, when the device C searches through the channel onwhich the network B is operating, the device B transmits a searchresponse signal to the device C (F515). Like the search signal, thesearch response signal has an automatic setting function or includes aninformation element indicating an automatic setting process in progress.Since the devices A and B have assigned their role to “providing device”at this time point, each of the devices A and B transmits a searchresponse signal including an information element indicating a providingdevice. Here, in addition to the information element indicating the role“providing device”, an information element indicating “available toprovide a communication parameter” may be added.

Consequently, the device C detects two providing devices that existnearby, that is, the devices A and B. Upon detection of two providingdevices that exist nearby, the device C displays on the display unit 105a message for prompting a user to select one of the devices A and B withwhich the user performs an automatic communication parameter settingprocess. In accordance with a user operation of the input unit 109, thedevice C selects one of the devices A and B with which an automaticcommunication parameter setting process is performed (F516).

After the selection process described above is performed, the device Cassigns its role to “receiving device” (F517). When it is determined inthe selection process in F516 that an automatic communication parametersetting process is to be performed between the devices A and C, thedevice C participates in the network A (F518). Then, the devices A and Cmutually transmit and receive communication messages (protocol messages)that are exchanged in the automatic communication parameter settingprotocol process. Since communication parameters such as an encryptionkey and an authentication key have not yet been set in the device C atthe time when the device C participates in the network A in F518, thedevice C is not allowed to perform normal data communication with thedevice A using encryption and authentication.

Here, the automatic communication parameter setting protocol processrefers to a process for transmitting and receiving various communicationmessages determined in advance in order to provide a communicationparameter from a providing device to a receiving device. In WPS, theabove protocol process is termed a Registration protocol. In theembodiment, for ease of description, a process including the followingprocedures 1 to 3 is used as an automatic communication parametersetting protocol process:

1. A message indicating the start of the communication parameter settingprocess (a message for requesting the provision of a communicationparameter) is transmitted from a receiving device to a providing device.2. In response to the message, the providing device provides acommunication parameter to the receiving device.3. When the provision of the communication parameter is completed, amessage indicating the completion of the communication parameter settingprocess is transmitted from the providing device to the receivingdevice.

When the device C participates in the network A, the device C transmitsa message indicating the start of the communication parameter settingprocess to the device A (F519). In response to the message, a providingprocess for providing the communication parameter A from the device A tothe device C is performed (F520). When the providing process iscompleted, the device A transmits a message indicating the completion ofthe communication parameter setting process to the device C (F521).Therefore, the communication parameter setting process is completed, andthe communication parameter A is shared between the devices A and C.

Then, the devices A and C perform a communication connection processusing the shared communication parameter A (F522). Automaticallystarting the communication connection process after the completion ofthe communication parameter setting process enables the devices A and Cto communicate with each other without causing a user to perform anoperation.

In the foregoing description, the device A is selected in the selectionprocess in F516. As can be understood from the above, when a userselects the device B in F516, the process described with respect to F516to F522 is performed between the devices B and C.

As described above, when a plurality of providing devices are detected,a message for prompting a user to select a providing device isdisplayed, and one of the providing devices with which an automaticcommunication parameter setting process is performed is selected inaccordance with a user operation. However, a communication device maynot necessarily be capable of selecting one of a plurality of providingdevices because of its poor user interface capabilities.

FIG. 6 illustrates an example of a sequence in the case of poor userinterface capabilities of a communication device. The operations of F601to F615 are similar to those of F501 to F515 illustrated in FIG. 5,respectively, and will not be discussed herein.

On the basis of the search response signal from the device A (F608) andthe search response signal from the device B (F615), the device Cdetects two providing devices that exist nearby, that is, the devices Aand B (F616). Due to the poor user interface capabilities, the device Cis not capable of determining from which providing device to receive acommunication parameter. Thus, the device C transmits an instructionsignal including an instruction for terminating the process of theproviding device to the devices A and B (F617, F618). Upon receipt ofthe instruction signal, each of the devices A and B terminates theautomatic communication parameter setting process (F619, F621). Thedevice C also terminates the automatic communication parameter settingprocess after the instruction signal is transmitted (F620). At thistime, each of the devices A, B, and C displays an error screenindicating the termination of the automatic communication parametersetting process on the display unit 105 to notify the user (F622, F623,F624). Therefore, when a receiving device detects a plurality ofproviding devices from which the receiving device can receive acommunication parameter, all the devices are caused to temporarilyterminate their communication parameter setting process. Then, a userwho recognizes the termination of the automatic setting process isprompted to restart the communication parameter setting process. In thiscase, the probability that both the devices A and B restart theautomatic setting process is low and therefore, the automatic settingprocess can possibly be performed between the device C and a desired oneof the devices A and B. In this manner, the communication parametersetting process performed by all the devices is temporarily stopped, andthen the automatic setting process is attempted once again when oneproviding device is determined. This can prevent a user from receiving acommunication parameter from an unintended providing device.

Next, a case where the networks A and B are the same will be described.A network configuration is illustrated in FIG. 4. FIG. 4 is a diagramillustrating the devices A, D, B, and E and an ad-hoc network 41(hereinafter referred to as a “network A”). The network A has alreadybeen established, by performing an automatic setting process between thedevices A, B, D, and E, using a communication parameter A shared betweenthe device A and each of the remaining devices.

FIG. 8 is a diagram illustrating an example of a process sequence forperforming an automatic setting process between the devices A, B, and Cby pressing the setting buttons 106 thereof.

The devices A and B already established the network A using thecommunication parameter A set in the automatic setting process (F801).The device C has not yet established a network.

Here, the setting buttons 106 of the respective devices are pressed.First, the device A confirms that it is participating in a network(F802). Since the device A has already participated in the network A,the device A assigns its role to “providing device”. Then, the device Asearches for a providing device other than the device A through thewireless LAN channel in which the device A operates (F803). In order tosearch for a providing device, the device A transmits a search signal(probe request) to the wireless LAN channel in which the device Aoperates (F808). On the other hand, the device B is currently operatingas a providing device because the setting button 106 thereof has beenpressed. Therefore, in response to the search signal (F808), a searchresponse signal (probe response) is transmitted from the device B to thedevice A (F809).

The device B performs an operation similar to that of the device A.Specifically, the device B confirms that it is participating in anetwork (F804). Since the device B has already participated in anetwork, the device B assigns its role to “providing device”, andsearches for another providing device through the same wireless LANchannel as that of the device B (F805). In order to search for aproviding device, the device B transmits a search signal to the samewireless LAN channel (F810). Since the device A is currently operatingas a providing device, a search response signal is transmitted from thedevice A to the device B (F811).

The above process allows the device A to recognize the presence of thedevice B and the device B to recognize the presence of the device A. Inother words, each of the devices A and B detects the presence of aplurality of providing devices (F812, F814).

Upon detection of the presence of a plurality of providing devices, eachof the devices A and B executes a predetermined process to determinewhich of them becomes the providing device in accordance with apredetermined standard (F824, F825). Examples of the predeterminedstandard may include the magnitude of a device identifier such as amedia access control (MAC) address or universally unique identifier(UUID), where a device with a high identifier may become the providingdevice. The identifier may be part of the MAC address or UUID. Both theMAC address and UUID may also be used. Alternatively, communicationdevices may be compared in accordance with the types of thecommunication devices (such as a printer and a camera), the type of use,the type of power (such as battery or alternating current (AC) power),the performance of the communication devices such as the processingpower of the central processing unit (CPU), or any other suitablestandard. Furthermore, in order to determine a providing device,predetermined messages may be exchanged, and a providing device may bedetermined on the basis of the exchanged information. In the exampleillustrated in FIG. 8, by way of example, the device B becomes theproviding device and the device A terminates the providing deviceprocess (F813).

In contrast, since the device C is not participating in a network, thedevice C performs a network search process on a plurality of wirelessLAN channels (F806). The wireless LAN channels to be searched may be allwireless LAN channels supported by communication devices or may be aplurality of channels specified in advance by a user. The device Ctransmits a search signal to each of the channels (F807). The searchsignal may have an automatic setting function or include an informationelement indicating an automatic setting process in progress. The deviceC detects two providing devices that are present in the same network,that is, the devices A and B. Upon detection of a plurality of providingdevices that are present in the same network, the device C waits for theproviding devices themselves to determine one of them. The device Crepeats a search for a predetermined period of time, and a searchresponse signal is transmitted (F817) only from the device B when asearch signal is transmitted (F816). Thus, it is determined that thedevice B is the providing device. The device C may also cancel theautomatic setting process when two providing devices that are present inthe same network are detected, as in a case where a plurality ofproviding devices are present in different networks or as ininfrastructure mode WPS. In a case where the device C cancels theautomatic setting process, a message for prompting a user to press thesetting button 106 once again may be displayed on a user interface. Atthe time when the setting button 106 is pressed once again, a singleproviding device has already been determined by the devices A and B.When it is determined that the automatic communication parameter settingprocess is performed between the devices B and C, the device Cparticipates in the network A (F818).

In the description of the embodiment, the setting buttons of the devicesA, B, and C are pressed at substantially the same time. In a case wherethe time at which the button of the device C is pressed is later thanthat of the devices A and B, one providing device has already beendetermined at the time when the device C performs an automatic settingprocess. In this case, therefore, the process of waiting for oneproviding device to be determined and the process of canceling theprocess, which have been described above, are not performed.

Accordingly, the devices B and C mutually transmit and receivecommunication messages (protocol messages) that are exchanged in anautomatic communication parameter setting protocol process. Sincecommunication parameters such as an encryption key and an authenticationkey have not yet been set in the device C at the time when the device Cparticipates in the network A in F818, the device C is not allowed toperform normal data communication with the device B using encryption andauthentication. When the device C participates in the network A, thedevice C transmits a message indicating the start of the communicationparameter setting process to the device B (F819). In response to themessage, a providing process for providing the communication parameter Afrom the device B to the device C is performed (F820). When theproviding process is completed, the device B transmits a messageindicating the completion of the communication parameter setting processto the device C (F821). Therefore, the communication parameter settingprocess is completed, and the communication parameter A is sharedbetween the devices B and C.

Then, the devices B and C perform a communication connection processusing the shared communication parameter A (F822). Automaticallystarting the communication connection process after the completion ofthe communication parameter setting process enables the devices B and Cto communicate with each other without causing a user to perform anoperation.

FIG. 9 is a flowchart illustrating an example of an operation flow ofthe devices A, B, and C. The operation illustrated in FIG. 9 isperformed by the control unit 102 of each device by reading andexecuting the control program stored in the storage units 103. Thecontrol executed by each device will now be described in accordance withthe flowchart illustrated in FIG. 9.

First, the device determines whether or not the setting button 106 hasbeen pressed in order to instruct the start of the automatic settingprocess (S901). When it is determined that the setting button 106 hasbeen pressed, the device determines whether or not it is participatingin a network (S902).

When the device is not participating in a network, the device starts atimer T1 with a time limit for searching for a providing device (S903).The device determines whether or not the timer T1 has expired (S904).When the timer T1 has not expired, the device transmits a search signal(for example, a probe request) to all wireless LAN channels (S905).After the search signal is transmitted, it is determined whether or nota search response signal has been received from a providing device(S906). When no search response signal has been received from aproviding device, the process returns to S904, and a search signal isrepeatedly transmitted (S905) until the timer T1 has expired.

When a search response signal has been received from a providing device,the device determines whether or not a plurality of providing devicesare present in different networks (S907). When a plurality of providingdevices present in different networks are not detected, the devicedetermines whether or not a plurality of providing devices are presentin the same network (S922). When a single providing device is present inthe same network, the communication device assigns its role to“receiving device” (S908), and performs a communication parameterreceiving process (S909). Specifically, the communication devicerequests the providing device to start a communication parameter settingprocess, and receives a communication parameter from the providingdevice.

When it is determined in S922 that a plurality of providing devices arepresent in the same network, the device waits for one providing deviceto be determined as a result of arbitration of the providing devices(S923). Thereafter, when one providing device is determined, thecommunication device assigns its role to “receiving device” (S908), andperforms a communication parameter receiving process (S909). The waitingprocessing of S923 may not necessarily be performed, and the process maybe terminated when a plurality of providing devices in the same networkare detected. In a case where the process is terminated, processes suchas displaying a message indicating the termination of the process on thedisplay unit 105 and prompting a user to press the setting button 106once again may be performed. In this case, one providing device haspossibly been determined at the time when the setting button 106 ispressed once again.

When a plurality of providing devices in different networks are detectedin S907, it is determined whether or not the communication device has aselection unit for selecting one specific providing device among aplurality of providing devices (S910). When the communication device hasa selection unit, a message for selecting a providing device isdisplayed, and a providing device from which a communication parameteris to be received is specified in accordance with a user operation(S911). After a providing device is specified, the communication deviceassigns its role to “receiving device” (S908) and performs acommunication parameter receiving process (S909) by requesting thespecified providing device to start a communication parameter settingprocess. This selection process corresponds to the operation of thedevice C described above with reference to FIG. 5.

When it is determined in S910 that the communication device does nothave a selection unit, the communication device transmits an instructionsignal for stopping the providing device process to all the detectedproviding devices (S912). The transmission of the instruction signalcorresponds to the operation of the device C described above withreference to FIG. 6.

Even when it is determined in S910 that the communication device has aselection unit, the process may proceed to S912 instead of S911depending on the intension of the user or the implementation of thecommunication device. Furthermore, the determination of S910 may beskipped and the processing of S911 or S912 may be performed. That is,when a plurality of providing devices in different networks are detectedin S907, the communication device may display a message for selecting aproviding device and specify a providing device from which acommunication parameter is to be received in accordance with a useroperation (S911). Furthermore, when a plurality of providing devices indifferent networks are detected in S907, the communication device mayalso transmit an instruction signal for stopping the providing deviceprocess to all the detected providing devices (S912).

Next, a process performed in a case where a communication device isparticipating in a network will be described. When it is determined inS902 that the communication device is participating in a network, thecommunication device assigns its role to “providing device” (S913), andstarts a timer T2 with a time limit for searching for a providing device(S914).

Thereafter, the communication device transmits a search signal (proberequest) to the wireless LAN channel in which the communication deviceoperates (S915). After the search signal is transmitted, it isdetermined whether or not a search response signal (probe response) hasbeen received from another providing device (S916). When no searchresponse signal has been received from another providing device, thecommunication device determines whether or not the timer T2 has expired(S921). When the timer T2 has not expired, the process returns to S915in order to perform a search process once again. When it is determinedin S921 that the timer T2 has expired with no search response signalhaving been received from another providing device, it is determinedthat no other providing device is present in the same wireless LANchannel as that of the communication device, and a communicationparameter providing process is started (S920).

When it is determined in S916 that a search response signal has beenreceived from another providing device, it is determined that aplurality of providing devices are present (S917). Then, thecommunication device determines whether or not to continue the providingdevice process (S919). In this determination, first, it is determinedwhether or not a plurality of providing devices including thecommunication device are present in the same network. When anotherproviding device is present in the same network, the communicationdevice determines which of the communication device and the otherproviding device is to continue the providing device functionality inaccordance with a predetermined standard. Examples of the predeterminedstandard may include the magnitude of a device identifier such as a MACaddress or UUID, where a device with a high identifier may becomes theproviding device. The identifier may be part of the MAC address or UUID.Both the MAC address and UUID may also be used. Alternatively,communication devices may be compared in accordance with the types ofthe communication devices (such as a printer and a camera), the type ofuse, the type of power (such as battery or AC power), the performance ofthe communication devices such as the processing power of the CPU, orany other suitable standard. Furthermore, in order to determine aproviding device, predetermined messages may be exchanged, and aproviding device may be determined on the basis of the exchangedinformation. When it is determined that the communication devicecontinues the providing device process, the communication device servesas the providing device and performs a communication parameter providingprocess. Specifically, the communication device waits for a request ofstarting a communication parameter setting process. Upon receipt of therequest, the communication device provides a communication parameter toa receiving device. When another providing device becomes the providingdevice, that is, when the communication device determines that thecommunication device does not perform the providing device process, theprocess ends.

When another providing device is present in a different network, uponreceipt of a signal for starting a communication parameter settingprocess (F519) from a receiving device (the device C), the communicationdevice continues the providing device process. Upon receipt of aninstruction signal for stopping the providing device process (F617,F618), the communication device stops the providing device process. Whenthe communication device is allowed to still operate as the providingdevice, the communication device continuously performs the communicationparameter providing process (S920). In contrast, when the providingdevice process is stopped, the communication device terminates theautomatic communication parameter setting process. In the processing ofS919, only one of a plurality of providing devices is allowed tocontinuously operate as the providing device. However, all the devicesmay stop the providing device operation.

According to the foregoing description, an automatic communicationparameter setting process can be prevented from failing due to thepresence of a plurality of providing devices. Furthermore, even when aplurality of providing devices exist, a communication parameter receivedfrom any of the providing devices in the same network can be used toparticipate in the same network. A communication device can receive acommunication parameter from any of the providing devices, and canparticipate in a network.

Second Embodiment

A second embodiment will be described with respect to an example inwhich when, as in the first embodiment, the networks A and B aredifferent networks and when the wireless LAN channels are the same, aproviding device is automatically determined.

FIG. 7 is a diagram illustrating an example of a process sequence forperforming an automatic setting process between the devices A, B, and Cby pressing the setting buttons 106 thereof.

The device A has already established the network A with the device Dusing the communication parameter A set in the automatic setting processperformed between the devices A and D (F701). The device B has alreadyestablished the network B with the device E using the communicationparameter B set in the automatic setting process performed between thedevices B and E (F704). The device C has not yet established a network.

Here, the setting buttons 106 of the respective devices are pressed.First, the device A confirms that it is participating in a network(F702). Since the device A has already participated in the network A,the device A assigns its role to “providing device”. Then, the device Asearches for a providing device other than the device A through thewireless LAN channel in which the device A operates (F703). In order tosearch for a providing device, the device A transmits a search signal(probe request) to the wireless LAN channel in which the device Aoperates (F708). On the other hand, the device B is currently operatingas a providing device because the setting button 106 thereof has beenpressed. Therefore, in response to the search signal (F708), a searchresponse signal (probe response) is transmitted from the device B to thedevice A (F709).

The device B performs an operation similar to that of the device A.Specifically, the device B confirms that it is participating in anetwork (F705). Since the device B has already participated in anetwork, the device B assigns its role to “providing device”, andsearches for another providing device through the same wireless LANchannel as that of the device B (F706). In order to search for aproviding device, the device B transmits a search signal to the samewireless LAN channel (F710). Since the device A is currently operatingas a providing device, a search response signal is transmitted from thedevice A to the device B (F711).

The above process allows the device A to recognize the presence of thedevice B and the device B to recognize the presence of the device A. Inother words, each of the devices A and B detects a plurality ofproviding devices operating in the same wireless LAN channel (F713,F715). Upon detection of the presence of a plurality of providingdevices, each of the devices A and B executes a predetermined process todetermine which of them becomes the providing device in accordance witha predetermined standard (F724, F725). Examples of the predeterminedstandard may include the magnitude of a device identifier such as a MACaddress or UUID, where a device with a high identifier may become theproviding device. The identifier may be part of the MAC address or UUID.Both the MAC address and UUID may also be used. Alternatively,communication devices may be compared in accordance with the types ofthe communication devices (such as a printer and a camera), the type ofuse, the type of power (such as battery or AC power), the performance ofthe communication devices such as the processing power of the CPU, orany other suitable standard. Furthermore, in order to determine aproviding device, predetermined messages may be exchanged, and aproviding device may be determined on the basis of the exchangedinformation. In the example illustrated in FIG. 7, by way of example,the device B becomes the providing device and the device A terminatesthe providing device process (F714).

In contrast, since the device C is not participating in a network, thedevice C performs a network search process on a plurality of wirelessLAN channels (F707). The wireless LAN channels to be searched may be allwireless LAN channels supported by communication devices or may be aplurality of channels specified in advance by a user. The device Ctransmits a search signal to each of the channels (F712). The searchsignal may have an automatic setting function or include an informationelement indicating an automatic setting process in progress.

The device C detects two providing devices operating in the samechannel, that is, the devices A and B. Since a plurality of providingdevices are operating in the same channel, the device C waits for theproviding devices themselves to determine one of them. The device Crepeats a search for a predetermined period of time, and a searchresponse signal is transmitted (F718) only from the device B when asearch signal is transmitted (F717). Thus, it is determined that thedevice B is the providing device.

The device C may also cancel the automatic setting process when twoproviding devices operating in the same channel are detected, as in acase where a plurality of providing devices are operating in differentchannels or as in infrastructure mode WPS. In a case where the device Ccancels the automatic setting process, a message for prompting a user topress the setting button 106 once again may be displayed on a userinterface. When the setting button 106 is pressed once again, a singleproviding device has been determined by the devices A and B.

When it is determined that the automatic communication parameter settingprocess is performed between the devices B and C in response to thesearch response signal (F718), the device C participates in the networkB (F719).

In the description of the embodiment, the setting buttons of the devicesA, B, and C are pressed at substantially the same time. In a case wherethe time at which the button of the device C is pressed is later thanthat of the devices A and B, one providing device has already beendetermined at the time when the device C performs an automatic settingprocess. In this case, therefore, the process of waiting for oneproviding device to be determined and the process of canceling theprocess, which have been described above, are not performed.

Accordingly, the devices B and C mutually transmit and receivecommunication messages (protocol messages) that are exchanged in anautomatic communication parameter setting protocol process. Sincecommunication parameters such as an encryption key and an authenticationkey have not yet been set in the device C at the time when the device Cparticipates in the network B in F719, the device C is not allowed toperform normal data communication with the device B using encryption andauthentication. When the device C participates in the network B, thedevice C transmits a message indicating the start of the communicationparameter setting process to the device B (F720). In response to themessage, a providing process for providing the communication parameter Bfrom the device B to the device C is performed (F721). When theproviding process is completed, the device B transmits a messageindicating the completion of the communication parameter setting processto the device C (F722). Therefore, the communication parameter settingprocess is completed, and the communication parameter B is sharedbetween the devices B and C.

Then, the devices B and C perform a communication connection processusing the shared communication parameter B (F723). Automaticallystarting the communication connection process after the completion ofthe communication parameter setting process enables the devices B and Cto communicate with each other without causing a user to perform anoperation.

In order to perform the operation illustrated in FIG. 7, instead ofperforming the processing of S907 illustrated in FIG. 9, each of thedevices A and B determines whether or not a plurality of providingdevices are operating in different channels. When a plurality ofproviding devices are detected in the determination, the processproceeds to S910, or proceeds to S911 or S912. When a plurality ofproviding devices are not operating in different channels, instead ofperforming the processing of S922, it is determined whether or not aplurality of providing devices are operating in the same channel. When aplurality of providing devices are operating in the same channel, theprocess proceeds to S923.

According to the embodiment, therefore, even in a case where providingdevices are present indifferent networks, when they are operating in thesame channel, a providing device is automatically determined. Thisallows a receiving device to receive a communication parameter from anyof the providing devices.

Furthermore, in S919 illustrated in FIG. 9, the communication devicedetermines whether or not a plurality of providing devices including thecommunication device exist. When another providing device exists, thecommunication device determines which of the communication device andthe other providing device is to continue the providing devicefunctionality in accordance with a predetermined standard. Examples ofthe predetermined standard may include the magnitude of a deviceidentifier such as a MAC address or UUID, where a device with a highidentifier may become the providing device. The identifier may be partof the MAC address or UUID. Both the MAC address and UUID may also beused. Alternatively, communication devices may be compared in accordancewith the types of the communication devices (such as a printer and acamera), the type of use, the type of power (such as battery or ACpower), the performance of the communication devices such as theprocessing power of the CPU, or any other suitable standard.Furthermore, in order to determine a providing device, predeterminedmessages may be exchanged, and a providing device may be determined onthe basis of the exchanged information. When it is determined that thecommunication device continues the providing device process, thecommunication device serves as the providing device and performs acommunication parameter providing process. Specifically, thecommunication device waits for a request of starting a communicationparameter setting process. Upon receipt of the request, thecommunication device provides a communication parameter to a receivingdevice. When another providing device becomes the providing device, thatis, when the communication device does not perform the providing deviceprocess, the process ends. In the determination of S919, therefore, aproviding device determination process is performed when a plurality ofproviding devices exist, without determining whether or not theplurality of providing devices are in the same network.

According to the embodiment, also, an automatic communication parametersetting process can be prevented from failing when a plurality ofproviding devices exist. In addition, even in a case where the providingdevices are in different networks, when they are operating in the samewireless LAN channel, one of the providing devices can detect the otherproviding device or devices. Therefore, the providing devices candetermine which providing device is to continue the process.

According to an embodiment of the present invention, therefore, when aplurality of providing devices exist, the possibility of failure of theautomatic setting of communication parameters can be reduced. Even whena plurality of providing devices exist, a user can possibly receive acommunication parameter from a desired providing device. Furthermore,even when the providing devices are in the same network, a communicationparameter received from any of them can be used to participate in thesame network. A communication device can receive a communicationparameter from any of the providing devices, and can participate in anetwork.

In the foregoing description, a providing device is searched for usingactive scan with a search signal and a search response signal.Alternatively, a passive scan in which a device searches for a providingdevice while waiting for a beacon to be received may be used. Acombination of active scan and passive scan may also be used to searchfor a providing device.

The foregoing description has been given in the context of an IEEE802.11 based wireless LAN, by way of example. However, the presentinvention may also be implemented using other wireless media such aswireless universal serial bus (USB), Multi Band Orthogonal FrequencyDivision Multiplexing (OFDM) Alliance (MBOA), Bluetooth (registeredtrademark), Ultra Wide Band (UWB), and ZigBee. The present invention mayalso be implemented using wired communication media such as a wired LAN.UWB includes wireless USB, wireless 1394, and WiMedia Network (WiNET).Furthermore, a communication parameter has been described in the contextof a network identifier, an encryption method, an encryption key, anauthentication method, or an authentication key, by way of example.However, it is to be understood that other information may be used andother information may be included in a communication parameter.

A recording medium storing program code of software implementing thefunctions described above may be supplied to a system or a device, and acomputer (CPU or a microprocessing unit (MPU)) of the system or devicemay read and execute the program code stored in the recording medium,thereby implementing an embodiment of the present invention.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

What is claimed is:
 1. A communication device comprising: adetermination unit configured to determine whether the communicationdevice participates in a wireless network; a first transmission unitconfigured to transmit a search signal to a plurality of channels in acase where the determination unit has determined that the communicationdevice does not participate in the wireless network; a secondtransmission unit configured to transmit, to a part of the plurality ofchannels to which the communication device belongs, the search signal ina case where the determination unit has determined that thecommunication device participates in the wireless network; and anexecution unit configured to execute, with another communication devicewhich has responded to the search signal, a setting process of acommunication parameter.
 2. The communication device according to claim1, further comprising: a control unit configured to control thecommunication device to operate as a providing device that provides thecommunication parameter in a case where the determination unit hasdetermined that the communication device participates in the wirelessnetwork.
 3. The communication device according to claim 1, furthercomprising: a detection unit configured to detect a predetermined useroperation, wherein, in a case where the detection unit has detected thepredetermined user operation, the determination unit determines whetherthe communication device participates in the wireless network.
 4. Thecommunication device according to claim 1, further comprising: adecision unit configured to decide, based on a predetermined condition,whether the setting process of the communication parameter is to beexecuted, in a case where the determination unit has determined that thecommunication device does not participate in the wireless network. 5.The communication device according to claim 1, wherein the communicationparameter includes at least one of a network identifier, an encryptionmethod, an encryption key, an authentication method, and anauthentication key.
 6. The communication device according to claim 1,wherein the execution unit executes the setting process of thecommunication parameter according to a procedure based on a Wi-FiProtected Setup (WPS).
 7. A method comprising: determining whether acommunication device participates in a wireless network; transmitting asearch signal to a plurality of channels in a case where thecommunication device does not participate in the wireless network;transmitting, to a part of the plurality of channels to which thecommunication device belongs, the search signal in a case where thecommunication device participates in the wireless network; andexecuting, with another communication device which has responded to thesearch signal, a setting process of a communication parameter.
 8. Acomputer readable storage medium storing a computer-executable programof instructions for causing a computer to perform a method comprising:determining whether a communication device participates in a wirelessnetwork; transmitting a search signal to a plurality of channels in acase where the communication device does not participate in the wirelessnetwork; transmitting, to a part of the plurality of channels to whichthe communication device belongs, the search signal in a case where thecommunication device participates in the wireless network; andexecuting, with another communication device which has responded to thesearch signal, a setting process of a communication parameter.